<?php
	

	class xl_dia_diem_yeu_thich extends database
	{
		
		function danhSachDiaDiemYeuThich($manguoidung)
		{
			$this->setQuerry("select * from diadiemyeuthich, diadiem, quanhuyen, tinhthanh where diadiem.madiadiem=diadiemyeuthich.madiadiem and quanhuyen.maquanhuyen=diadiem.maquanhuyen and tinhthanh.matinhthanh=diadiem.matinhthanh and diadiemyeuthich.manguoidung=".$manguoidung."");
			$result = $this->loadAllRow();
			return $result;
		}
		// thuỳ
		
		function danhSachDiaDiemYeuThich_First($manguoidung)
		{
			$this->setQuerry("select * from diadiemyeuthich, diadiem, quanhuyen, tinhthanh where diadiem.madiadiem=diadiemyeuthich.madiadiem and quanhuyen.maquanhuyen=diadiem.maquanhuyen and tinhthanh.matinhthanh=diadiem.matinhthanh and diadiemyeuthich.manguoidung=".$manguoidung." order by diadiem.madiadiem ASC limit 0,10");
			$result = $this->loadAllRow();
			return $result;
		}
		
		function danhSachDiaDiemYeuThich_ViewMore($manguoidung,$madiadiem)
		{
			$this->setQuerry("select * from diadiemyeuthich, diadiem, quanhuyen, tinhthanh where diadiem.madiadiem=diadiemyeuthich.madiadiem and quanhuyen.maquanhuyen=diadiem.maquanhuyen and tinhthanh.matinhthanh=diadiem.matinhthanh and diadiemyeuthich.manguoidung=".$manguoidung." and diadiem.madiadiem >".$madiadiem." order by diadiem.madiadiem ASC limit 0,10");
			$result = $this->loadAllRow();
			return $result;
		}
		//
		
		function tongYeuThich($madiadiem){
			$this->setQuerry("select * from diadiemyeuthich where MaDiaDiem = '$madiadiem'");
			$result=$this->loadAllRow();
			return count($result);
		}
		function isDiaDiem($madiadiem, $manguoidung){
			$this->setQuerry("select * from diadiemyeuthich where MaDiaDiem = '$madiadiem' and MaNguoiDung = '$manguoidung'");
			$result=$this->loadAllRow();
			return count($result);
		}
		function themDiaDiem($madiadiem,$manguoidung)

		{
			$this->setQuerry("insert into diadiemyeuthich (MaDiaDiem, MaNguoiDung) values('$madiadiem','$manguoidung')");
			$result=$this->querry();
			return $result;
		}
		function capNhatDiaDiem($mayeuthich,$madiadiem,$manguoidung)
		{
			$this->setQuerry("update diadiemyeuthich set MaDiaDiem=$madiadiem, MaNguoiDung=$manguoidung where MaHinhAnh=$mahinhanh");
			$result=$this->querry();
			return $result;
		}
		function xoaDiaDiem($mayeuthich)
		{
			$this->setQuerry("delete from diadiemyeuthich where MaYeuThich=".$mayeuthich);
			$result=$this->querry();
			return $result;
		}
		function xoaTatCaYeuThich()
		{
			$this->setQuerry("delete from diadiemyeuthich");
			$result=$this->querry();
			return $result;
		}
	}
?>